package com.nyp.remoter.web;

import java.io.Serializable;
import java.util.List;

import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.faces.event.AjaxBehaviorEvent;
import javax.inject.Named;

import com.nyp.remoter.ejb.SearchEJB;
import com.nyp.remoter.entity.Cat;
import com.nyp.remoter.entity.Dog;
import com.nyp.remoter.entity.User;

@Named
@SessionScoped
public class SearchJSFBean implements Serializable {
	
	private User userFilter = new User();
	private Long dogId;
	private List<User> searchResultUsers;
	private List<Cat> searchResulCats;

	@EJB
	private SearchEJB searchEJB;
	
	public String doSearchUser(AjaxBehaviorEvent ev) {
		searchResultUsers = searchEJB.searchUser(userFilter);
		//searchEJB.searchUserWithCats(null);
		return null;
	}
	
	public String doSearchCatsofOwner(AjaxBehaviorEvent ev) {
		//TODO searchResulCats = 
		return null;
	}
	
	public String doSearchCatsChasedByDog(AjaxBehaviorEvent ev) {
		//TODO searchResulCats = 
		return null;
	}
	
	

	public List<User> getSearchResultUsers() {
		return searchResultUsers;
	}

	public void setSearchResultUsers(List<User> searchResultUsers) {
		this.searchResultUsers = searchResultUsers;
	}

	public List<Cat> getSearchResulCats() {
		return searchResulCats;
	}

	public void setSearchResulCats(List<Cat> searchResulCats) {
		this.searchResulCats = searchResulCats;
	}

	public User getUserFilter() {
		return userFilter;
	}

	public void setUserFilter(User userFilter) {
		this.userFilter = userFilter;
	}

	public Long getDogId() {
		return dogId;
	}

	public void setDogId(Long dogId) {
		this.dogId = dogId;
	}

}
